import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:szwf/page/comeOut/index.dart';
import 'package:szwf/page/endOut/index.dart';
import 'package:szwf/page/loading.dart';
import 'package:szwf/page/login/index.dart';
import 'package:szwf/page/not_found.dart';
import 'package:szwf/page/out/index.dart';
import 'package:szwf/page/put/index.dart';
import 'package:szwf/page/room_detail/index.dart';
import 'package:szwf/page/scan/index.dart';

class Routes{
  static String login = '/login';//登录页
  static String comeOut='/';//主页
  static String notFound404 = '/404';//报错也
  static String loading = '/loading';//启动页
  static String put = '/put';//入库
  static String scan = '/scan';//扫码
  static String out = '/out';//出库
  static String endOut = '/endOut';//完成出库

  static Handler _loginHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return LoginPage();
  });

  static Handler _notFoundHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return NotFoundPage();
  });


  static Handler _loadingHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return LoadingPage();
  });

  static Handler _comeOutHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return ComeOut();
  });

  static Handler _putHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return PutPage();
  });

  static Handler _outHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return OutPage();
  });

  static Handler _scanHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return BarCodeScanPage();
  });

  static Handler _endOutHandler =
  Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return EndOut('路由');
  });

  static void configureRoutes(Router router){
    router.define(login,handler:_loginHandler);
//    router.define(notFound404,handler:_notFoundHandler);


    router.define(loading, handler: _loadingHandler);
    router.define(comeOut, handler: _comeOutHandler);
    router.define(put, handler: _putHandler);
    router.define(out, handler: _outHandler);
    router.define(scan, handler: _scanHandler);
    router.define(endOut, handler: _endOutHandler);
    router.notFoundHandler = _notFoundHandler;
  }
}


